<div class="panel panel-default" id="infos">
	<div class="panel-heading">
		<h4>新增文章</h4>
	</div>
	<div class="panel-body">
		<form th:action="@{/admin/m/base/info/add.gsp}" id="addForm" class="form-horizontal" role="form" action="#" method="post">
			<div class="row">
				<div class="col-md-12">
					<input name="nodeId" th:value="${node.id}" type="hidden" />
					<div class="form-group">
						<label class="col-md-2 control-label">文章标题<label class="text-danger">*</label>：
						</label>
						<div class="col-md-7">
							<input name="title" placeholder="请输入文章标题" type="text" class="form-control " />
						</div>
						<div class="col-md-3">
							<input type="text" name="titleColor" class="form-control colorpicker-demo1" style="width: 100px; float: left;" />
							<div class="btn-group" data-toggle="buttons">
								<label class="btn btn-primary"> <input type="checkbox" autocomplete="off" value="1" name="titleStrong" /> <i class="fa fa-bold"></i>
								</label> <label class="btn btn-primary"> <input type="checkbox" autocomplete="off" value="1" name="titleEm" /> <i class="fa fa-italic"></i>
								</label>
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-2 control-label">链接地址：</label>
						<div class="col-md-10">
							<input name="linkPath" placeholder="请输入链接地址" type="text" class="form-control " />
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-2 control-label">关键字：</label>
						<div class="col-md-10">
							<input name="metaKeywords" placeholder="请输入关键字" type="text" class="form-control " />
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-2 control-label">描述：</label>
						<div class="col-md-10">
							<textarea name="metaDescription" placeholder="请输入描述" rows="3" class="form-control "></textarea>
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-2 control-label">排序<label class="text-danger">*</label>：
						</label>
						<div class="col-md-4">
							<input type="text" class=" form-control" value="1" name="sortOrder" />
						</div>
						<label class="col-md-2 control-label">发布日期： </label>
						<div class="col-md-4" id="daterange">
							<div class="input-daterange input-group">
								<input type="text" class=" form-control" name="publishTime" /> <span class="input-group-addon">到</span> <input type="text" class=" form-control" name="offTime" />
							</div>
						</div>
					</div>
					<div id="formBuilderDiv"></div>
				</div>
				<div class="col-md-12 text-right">
					<button class="btn btn-primary" type="submit">
						<strong>提 交</strong>
					</button>
					<button type="button" class="btn btn-default closeBtn">
						<strong>取 消</strong>
					</button>
				</div>
			</div>
		</form>
	</div>
</div>
<script th:inline="javascript">
    /*<![CDATA[*/
    $('.closeBtn').click(function() {
        var infoListUrl = /*[[@{/admin/m/base/info/infoList_{nodeId}.gsp(nodeId=${node.id})}]]*/'';
        $("#infoContent").load(infoListUrl);
    });
    $('#daterange .input-daterange').datepicker({
        keyboardNavigation : false,
        forceParse : false,
        autoclose : true
    });
    $(function() {
        var rules = {
            title : {
                required : true,
                maxlength : 40
            },
            linkPath : {
                url : true
            },
            sortOrder : {
                required : true,
                digits : true,
                range : [ 1, 100 ]
            },
            publishTime : {
                date : true
            },
            offTime : {
                date : true
            },
            metaKeywords : {
                maxlength : 100
            },
            metaDescription : {
                maxlength : 250
            }
        }
        var messages = {

        }
        tg_baseFormAjaxSubmit('addForm', rules, messages, function() {
            tg_alertSuccess();
            var infoListUrl = /*[[@{/admin/m/base/info/infoList_{nodeId}.gsp(nodeId=${node.id})}]]*/'';
            $("#infoContent").load(infoListUrl);
        });

        var infoModelId = /*[[${node.infoModelId}]]*/'infoModelId';
        formBuilder({
            ownerType : 'infoModel',
            ownerId : infoModelId,
            valueOwnerId : '' // 新增不需要
        });
    });
    /*]]>*/
</script>
